<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="/css/style.css" type="text/css"
	media="screen" />
<title>丫丫微博通</title>
</head>
<body>
<div id="page"><%@ include file="header.jsp"%>
<div id="wrapper">
<div id="content">
<div class="error"><c:if test="${!user.activity}">
				您的帐号处于非活跃状态，不会进行自动同步。帐号达到激活状态必须满足以下几个条件:
				<ul>
					<li>至少绑定了两个帐号，且有两个帐号处于激活状态。</li>
					<li>如果是主从同步的方式，必须有一个主帐号，并且主帐号必须处于激活状态。</li>
				</ul>
			</c:if></div>
<h1>我的帐号</h1>
<c:if test="${!hasAccount}">
<div class="error">
您还没有绑定帐号。请选择下面的帐号类型点击添加链接进行绑定。
</div>
</c:if> <c:if test="${hasAccount}">
	<form action="/update-cfg" method="post">
	同步方式:
	主从同步<input type="radio" name="sync_type" value="0" <c:if test="${user.syncType.value==0}"> checked="checked" </c:if>>&nbsp; 互相同步<input type="radio" name="sync_type" value="1" <c:if test="${user.syncType.value==1}"> checked="checked" </c:if>>
	<table width="100%">
		<tr>
			<td></td>
			<td>
			<td>id</td>
			<td>用户名</td>
			<td>是否激活</td>
			<c:if test="${user.syncType.value==0}">
			<td>是否为主帐号</td>
			</c:if>
			<td>同步数目</td>
			<td>最后同步时间</td>
			<td>最后同步微博</td>
			<td></td>
		</tr>
		<c:forEach var="account" items="${accounts}">
			<tr>
				<td><a href="${account.serviceType.url}" target="_blank"><img src="/images/${account.serviceType}-logo.png" /></a></td>
				<td><a href="${account.url}" target="_blank"><img src="${account.profileImage}" /></a></td>
				<td>${account.originalId}</td>
				<td>${account.name}</td>
				<td><input type="checkbox" name="activity"
					value="${account.keyName}"
					<c:if test="${account.activity}"> checked="checked" </c:if>></td>
						<c:if test="${user.syncType.value==0}">
				<td><input type="radio" name="master"
					value="${account.keyName}"
					<c:if test="${account.master}"> checked="checked" </c:if>></td>
					</c:if>
				<td>
				<c:if test="${user.syncType.value==0}">
				<c:if test="${account.master}">${account.syncFromCount}</c:if><c:if test="${!account.master}">${account.syncToCount}</c:if>
				</c:if>
				<c:if test="${user.syncType.value==1}">
				${account.syncFromCount}
				</c:if>
				</td>
				<td><fmt:formatDate value="${account.lastSyncDate}" 
    pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td><c:if test="${!empty account.lastSyncdStatus}">
				${account.lastSyncdStatus.formatText}
				</c:if>
				</td>
				<td><a href="/account?method=delete&key=${account.keyName}">删除</a></td>
			</tr>
		</c:forEach>
		<tr>
			<td colspan="10"><input type="submit" value="更新设置" /></td>
		</tr>
	</table>
	</form>
</c:if>
<h3>绑定帐号</h3>
<div id="service-box"><c:forEach var="service" items="${services}">
	<div class="service"><img src="/images/${service}-logo.png" />
	${service.title} <a href="/bind?service_type=${service}"
		title="${service.title}">添加</a></div>
</c:forEach></div>
</div>
<div id="sidebar">
  <%@ include file="left.jsp"%>
</div>
</div>

<%@ include file="footer.jsp"%></div>
</body>
</html>